package com.wang.example.netty.handler.server;

import com.wang.basic.netty.handler.Message;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;


public class EchoServerInHandler2 extends SimpleChannelInboundHandler<Message> {
    /**
     * 服务端读取到网络数据后的处理
     * @param ctx
     * @param msg
     * @throws Exception
     */
    @Override
    public void channelRead0(ChannelHandlerContext ctx, Message msg)
            throws Exception {
        System.out.println("EchoServerInHandler2 收到消息：" + msg);
        Message message = new Message();
        message.setContent("success");
        ctx.writeAndFlush(message);
    }
}
